// API响应类型定义
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
  timestamp: number
}

// 分页响应类型
export interface PageResult<T> {
  pageNo: number
  pageSize: number
  total: number
  totalPages: number
  result: T[]
  start: number
  end: number
}

// 用户信息类型
export interface UserInfo {
  id: number
  username: string
  email: string | null
  password: string | null
  nickname: string
  avatar: string | null
  bio: string | null
  website: string | null
  role: string
  status: string | null
  lastLoginTime: string | null
  lastLoginIp: string | null
  createdAt: string
  updatedAt: string | null
  deleted: number | null
}

// 登录请求类型
export interface LoginRequest {
  username: string
  password: string
}

// 登录响应类型
export interface LoginResponse {
  userInfo: UserInfo
  token: string
  tokenType: string
  expiresIn: number
}

// 注册请求类型
export interface RegisterRequest {
  username: string
  password: string
  email: string
  nickname: string
}

// 用户统计类型
export interface UserStats {
  total: number
  size: number
  page: number
  userId: number
  posts: any[]
}

// 分页参数类型
export interface PageParams {
  page?: number
  size?: number
}

// 文章相关类型
export interface Post {
  id: number
  title: string
  content: string
  excerpt: string
  coverImage: string | null
  status: string
  viewCount: number | null
  likeCount: number | null
  commentCount: number | null
  isTop: number
  isRecommend: number
  password: string | null
  userId: number
  categoryId: number
  publishedAt: string | null
  createdAt: string
  updatedAt: string
  deleted: number
  tags: Tag[] | null
  tagIds: number[] | null
}

// 文章请求类型
export interface PostRequest {
  title: string
  content: string
  excerpt: string
  coverImage?: string
  status: string
  isTop: number
  isRecommend: number
  categoryId: number
  tagIds: number[]
}

// 文章查询参数类型
export interface PostQueryParams {
  pageNo: number
  pageSize: number
  keyword?: string
  status?: string
  categoryId?: number
  tagId?: number
  orderBy?: string
  asc?: string
}

// 文章统计类型
export interface PostStats {
  id: number
  title: string
  viewCount: number | null
  likeCount: number | null
  commentCount: number | null
  favoriteCount: number
  shareCount: number
}

// 分类相关类型
export interface Category {
  id: number
  name: string
  slug: string
  description: string
  parentId: number
  orderNum: number
  postCount: number
  createdAt: string
  updatedAt: string
  deleted: number
}

// 分类请求类型
export interface CategoryRequest {
  name: string
  slug: string
  description: string
  parentId: number
  orderNum: number
}

// 标签相关类型
export interface Tag {
  id: number
  name: string
  slug: string
  description: string | null
  color: string
  postCount: number
  createdAt: string
  updatedAt: string
  deleted: number
}

// 标签请求类型
export interface TagRequest {
  name: string
  slug: string
  description?: string
  color: string
}

// 评论相关类型
export interface Comment {
  id: number
  content: string
  type: string
  userId: number
  postId: number
  parentId: number
  replyTo: number | null
  likeCount: number
  status: string
  ipAddress: string | null
  userAgent: string | null
  createdAt: string
  updatedAt: string
  deleted: number
  userNickname?: string | null
  userAvatar?: string | null
  replyToNickname?: string | null
  children?: Comment[]
}

// 评论请求类型
export interface CommentRequest {
  content: string
  postId: number
  parentId?: number
  replyTo?: number
}

// 点赞相关类型
export interface Like {
  id: number
  userId: number
  targetType: string
  targetId: number
  createdAt: string
}

// 文件相关类型
export interface File {
  id: number
  originalName: string
  fileName: string
  filePath: string
  fileSize: number
  fileType: string
  mimeType: string
  bucketName: string
  userId: number
  isImage: number
  width: number
  height: number
  createdAt: string
  updatedAt: string
  deleted: number
}

// 系统统计相关类型
export interface SystemStats {
  userCount: number
  postCount: number
  commentCount: number
  totalVisits: number
  todayVisits: number
  totalLikes: number
  fileCount: number
}

export interface Setting {
  id: number
  settingKey: string
  settingValue: string
  description: string
  type: string
  createdAt: string
  updatedAt: string
}

export interface VisitRecord {
  id: number
  postId: number
  visitDate: string
  visitCount: number
  uniqueVisitor: number
  createdAt: string
  updatedAt: string
}

export interface SearchRecord {
  id: number
  keyword: string
  searchCount: number
  userId: number
  createdAt: string
  updatedAt: string
}